home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / stackey3.zip / MAKEMESS.ASM < prev    next >
Assembly Source File  |  1990-03-25  |  6KB  |  175 lines

  1.                               title MAKEMESS.ASM
  2. ;Copyright (C) 1990 by B. Simon and R. M. Wilson, all rights reserved.
  3.  
  4.       ;--------------------------------------------------------------;
  5.       ; This file may be modified by assembly language programmers.  ;
  6.       ; You may change anything in boxes like this one.              ;
  7.       ; But BE CAREFUL.  Then assemble, link, and exe2bin and        ;
  8.       ; rename to message.bin or sample.msg (or whatever you like).  ;
  9.       ;                    DO NOT RUN FROM DOS!!!                    ;
  10.       ;                                                              ;
  11.       ; Example:                                                     ;
  12.       ;   STACKEY  ex(sample.msg) :1 be 'yes' j0  :2 'no'            ;
  13.       ;                                                              ;
  14.       ; (The "findlabel" procedure below may be incorporated into    ;
  15.       ; other external programs to be called by STACKEY.)            ;
  16.       ;--------------------------------------------------------------;
  17.  
  18. ;--------------------------;
  19. main_attribute = 30h       ;
  20. border = 3bh               ;
  21. screen_offset = 660        ;
  22. ;--------------------------;
  23.  
  24. cseg segment
  25.         assume  cs:cseg
  26.  
  27. begin:  mov dx,offset endmess-offset beginmess
  28.         mov es,ds:[40h]          ;segment of screen
  29.         add si, offset beginmess-offset begin
  30.         add si,dx
  31.         mov bx,si                ;now points to endmess
  32.         push di
  33.  
  34.         mov di,screen_offset     ;save user's screen
  35.         call savesc
  36.         mov di,160+screen_offset
  37.         call savesc
  38.         mov di,320+screen_offset
  39.         call savesc
  40.  
  41.         mov ah,border            ;draw box and print message
  42.         mov di,screen_offset
  43.         mov al,'╔'
  44.         stosw
  45.         mov al,'═'
  46.         mov cx,dx
  47.         rep stosw
  48.         mov al,'╗'
  49.         stosw
  50.         mov di,160+screen_offset
  51.         mov al,'║'
  52.         stosw
  53.         add di,dx
  54.         add di,dx
  55.         stosw
  56.         mov di,320+screen_offset
  57.         mov al,'╚'
  58.         stosw
  59.         mov al,'═'
  60.         mov cx,dx
  61.         rep stosw
  62.         mov al,'╝'
  63.         stosw
  64.         mov ah,main_attribute
  65.         mov di,162+screen_offset
  66.         mov si,bx
  67.         sub si,dx                ;points to beginmess
  68.         mov cx,dx
  69.       loopy: lodsb
  70.         stosw
  71.         loop loopy
  72.         mov si, bx               ;offset endmess for restoring later
  73.  
  74.         xor bx,bx
  75.       getkey:  xor ah,ah
  76.         int 16h
  77.  
  78. ;-----------------------------------------------------------------;
  79. ;  Change stuff between these lines.  For example, you could say  ;
  80.        ; or al,20H                                                ;
  81.        ; cmp al,'a'                                               ;
  82.        ; je label0                                                ;
  83.        ; cmp al,'b'                                               ;
  84.        ; je label1                                                ;
  85.        ; cmp al,'c'                                               ;
  86.        ; je label2                                                ;
  87.        ; cmp al,'d'                                               ;
  88.        ; je label3                                                ;
  89.        ; cmp al,'e'                                               ;
  90.        ; je label4                                                ;
  91.        ; cmp al,'f'                                               ;
  92.        ; je label5                                                ;
  93.        ; cmp al,'g'                                               ;
  94.        ; je label6                                                ;
  95.        ; cmp al,'h'                                               ;
  96.        ; je label7                                                ;
  97.        ; cmp al,'i'                                               ;
  98.        ; je label8                                                ;
  99.        ; cmp al,'j'                                               ;
  100.        ; je label9                                                ;
  101.                                                                   ;
  102.         cmp al,1bh   ;esc                                         ;
  103.         je label0                                                 ;
  104.         or al,20H    ;force lower case                            ;
  105.         cmp al,'y'                                                ;
  106.         je label1                                                 ;
  107.         cmp al,'n'                                                ;
  108.         je label2                                                 ;
  109. ;-----------------------------------------------------------------;
  110.         jmp getkey
  111.  
  112.       label9:  inc bx
  113.       label8:  inc bx
  114.       label7:  inc bx
  115.       label6:  inc bx
  116.       label5:  inc bx
  117.       label4:  inc bx
  118.       label3:  inc bx
  119.       label2:  inc bx
  120.       label1:  inc bx
  121.       label0:
  122.  
  123.         mov di,screen_offset
  124.         call restsc
  125.         mov di,160+screen_offset
  126.         call restsc
  127.         mov di,320+screen_offset
  128.         call restsc
  129.         pop di
  130.         jmp findlabel
  131.  
  132.       savesc: mov cx,dx
  133.         inc cx
  134.         inc cx
  135.       savesc2:  mov ax,es:[di]
  136.         inc di
  137.         inc di
  138.         mov ds:[si],ax
  139.         inc si
  140.         inc si
  141.         loop savesc2
  142.         ret
  143.       restsc: mov cx,dx
  144.         inc cx
  145.         inc cx
  146.         rep movsw
  147.         ret
  148.  
  149.       findlabel: mov bh,0ffh     ;Jumps to label number bl on the STACKEY
  150.         mov si,ds:[6eh]          ;   command line.
  151.       comp: cmp si,ds:[74h]
  152.         jae foundlabel
  153.         lodsw
  154.         cmp ax,bx
  155.         je foundlabel
  156.         cmp ah,0f1h              ;code for inline
  157.         jne comp
  158.         lodsw
  159.         sub ax,4
  160.         add si,ax
  161.         jmp comp
  162.       foundlabel: mov ds:[72h],si
  163.         ret
  164.  
  165. ;--------------------------------------------------;
  166. beginmess db 'Press <y> for Yes, <n> for No.'      ; At most 78 bytes.
  167. ;--------------------------------------------------;
  168.  
  169. endmess dw 3*(2+$-offset beginmess) dup(0)
  170.  
  171.         ret      ;just for form
  172.  
  173. cseg ends
  174. end begin
  175.